

//
//  HPComposedBtn.swift
//  MyWeibo
//
//  Created by Apeng on 16/4/19.
//  Copyright © 2016年 Apengpeng. All rights reserved.
//

import UIKit

class HPComposedBtn: UIButton {
    
    var composedItem: HPComposed? {
        didSet {
            setTitle(composedItem?.title, forState: .Normal)
            setImage(UIImage(named: composedItem?.icon ?? ""), forState: .Normal)
        }
    }

    let imageW: CGFloat = 80
    override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: 0, width: imageW, height: imageW)
    }
    
    override func titleRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: imageW, width: imageW, height: contentRect.size.height - imageW)
    }

}
